// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) 2015-2020 Andrey Antukh <niwi@niwi.nz>
// Copyright (c) 2015-2020 Juan de la Cruz <delacruzgarciajuan@gmail.com>

.settings-bar {
  background-color: $color-gray-50;
  border-left: 1px solid $color-gray-60;
  position: relative;

  &.settings-bar-left {
    border-left: none;
    border-right: 1px solid $color-gray-60;

    & .tab-container-tabs {
      padding-left: 1.5rem;
    }
  }

  .settings-bar-inside {
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 100%;
    height: calc(100% - 2px);

    .tool-window {
      position: relative;
      border-bottom: 1px solid $color-gray-60;
      display: flex;
      flex-direction: column;
      flex: 1;
      width: 100%;
      height: 100%;

      .tool-window-bar {
        align-items: center;
        display: flex;
        flex-shrink: 0;
        padding: $size-2;
        overflow: hidden;

        svg {
          fill: $color-gray-20;
          height: 12px;
          width: 12px;
        }

        span {
          color: $color-gray-10;
          font-size: $fs14;
          max-width: 100%;
          overflow-x: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        span.tool-badge {
          border: 1px solid $color-primary;
          border-radius: 2px;
          font-size: $fs10;
          color: $color-primary;
          padding: 2px 4px;
          margin-left: auto;
        }

        span.tool-link {
          margin-left: auto;

          svg {
            fill: $color-gray-30;
            height: 16px;
            width: 16px;
          }

          &:hover {
            svg {
              fill: $color-primary;
            }
          }
        }

        .tool-window-bar-icon {
          height: 21px;
          display: flex;
          align-items: center;
          justify-content: center;

          svg {
            width: 15px;
            height: 15px;
          }
        }

        &.big {
          height: 3rem;
          padding-bottom: 1rem;
        }

        .tool-window-bar-title {
          font-size: $fs14;
          margin-left: 0.5rem;
        }

        .tool-window-icon {
          margin-right: $size-2;
          display: none;
        }

        .tool-window-close {
          cursor: pointer;
          margin-left: auto;
          transform: rotate(45deg);

          &:hover {
            svg {
              fill: $color-danger;
            }
          }
        }
      }

      & .focus-title {
        width: 100%;
        height: 100%;
        display: grid;
        align-items: center;
        grid-template-columns: auto 1fr auto;
        grid-column-gap: 8px;
        cursor: pointer;

        & .back-button {
          background: none;
          border: none;
          padding: 0;
          margin: 0;

          & svg {
            fill: $color-white;
            transform: rotate(180deg);
            margin-top: 3px;
          }

          &:hover {
            svg {
              fill: $color-primary;
            }
          }
        }

        & .focus-name {
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }

        & .focus-mode {
          color: $color-primary;
          border: 1px solid $color-primary;
          border-radius: 3px;
          font-size: 10px;
          text-transform: uppercase;
          padding: 0px 4px;
          display: flex;
          align-items: center;
        }
      }
    }

    .assets-bar .tool-window {
      flex: none;
      height: auto;
    }
  }

  & > .resize-area {
    position: absolute;
    width: 8px;
    height: 100%;
    z-index: 10;
    cursor: ew-resize;
  }

  &.settings-bar-left > .resize-area {
    right: -8px;
  }

  &.settings-bar-right > .resize-area {
    left: -4px;
  }
}

.tool-window-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow-y: auto;
}

.element-list {
  margin: 0;
  width: 100%;

  ul {
    border-left: 9px solid $color-gray-50;
    margin: 0 0 0 0.4rem;

    li {
      border-left: 1px solid $color-gray-40;
    }
  }

  li {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    width: 100%;
    padding-top: 1px;
    padding-bottom: 1px;

    &.open {
      ul {
        li {
          .element-list-body {
            border-style: dashed;
          }
        }
      }
    }
  }
}

.element-list.pages-list {
  max-height: 10rem;

  .context-menu {
    position: fixed;
  }

  .context-menu-items {
    border: none;
    margin: none;
  }

  .context-menu-action {
    width: 100%;
  }
}

button.collapse-sidebar {
  background: none;
  border: none;
  cursor: pointer;
  height: 2.5rem;
  padding-top: 0.75rem;
  position: absolute;
  width: 1rem;

  & svg {
    width: 12px;
    height: 12px;
    fill: $color-gray-20;
    transform: rotate(180deg);
  }

  &.collapsed {
    background: $color-gray-60;
    left: 48px;
    top: 48px;
    width: 28px;
    height: 48px;
    padding: 0;
    border-radius: 0px 4px 4px 0px;
    border-left: 1px solid $color-gray-50;

    & svg {
      transform: rotate(0deg);
    }
  }
}

#layers.tool-window {
  overflow: auto;
}

.layers-tab {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 100%;
  height: 100%;
  overflow: hidden;
}

.shortcuts {
  .shortcuts-header {
    display: flex;
    height: 40px;
    background-color: $color-gray-60;
    .shortcuts-title {
      color: $color-white;
      font-size: $fs12;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-grow: 1;
      svg {
        height: 18px;
        width: 18px;
        transform: rotate(45deg);
        fill: $color-gray-20;
      }
    }
    .shortcuts-close-button {
      display: flex;
      justify-content: center;
      background-color: transparent;
      border: none;
      cursor: pointer;
      padding: 2px 0 2px 15px;
      position: absolute;
      top: 8px;
      svg {
        height: 18px;
        width: 18px;
        transform: rotate(45deg);
        fill: $color-gray-20;
      }
    }
  }

  .search-field {
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 10px;
    .search-box {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 1px solid $color-gray-30;
      border-radius: 2px;
      width: 100%;
      .input-text {
        margin: 0;
        background: $color-gray-50;
        width: 100%;
        color: $color-white;
        &:focus {
          border-bottom: none;
        }
      }
      .icon-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        &.close {
          transform: rotate(45deg);
        }
      }
      svg {
        width: 16px;
        height: 16px;
        margin: 0 7px;
        cursor: pointer;
        fill: $color-gray-20;
      }
    }
  }

  .shortcut-list {
    border-top: 1px solid $color-gray-60;
    padding: 10px;
    overflow-y: auto;
    height: 90%;
    margin-bottom: 15px;
    .section-title {
      background-color: $color-gray-60;
      padding: 4px 0;
    }
    .section-title,
    .subsection-title {
      display: flex;
      cursor: pointer;
      margin-top: 4px;
      font-size: $fs12;

      .section-name {
        color: $color-white;
      }
      .collapesed-shortcuts {
        padding: 0 10px;
        svg {
          height: 8px;
          width: 8px;
          fill: $color-gray-20;
        }
        &.open {
          svg {
            transform: rotate(90deg);
          }
        }
      }
      .shortcut-count {
        padding-left: 5px;
        color: $color-white;
      }
    }
    .subsection-title {
      padding: 4px 0px;
      .subsection-name {
        color: $color-white;
      }
    }

    .section-title,
    .subsection-title {
      &:hover {
        background-color: $color-primary;
        .subsection-name,
        .section-name {
          color: $color-gray-60;
        }
        svg {
          fill: $color-gray-60;
        }
      }
    }

    .shortcut-name {
      border: 1px solid $color-gray-60;
      border-radius: 4px;
      padding: 7px;
      display: flex;
      justify-content: space-between;
      margin-top: 4px;
      color: $color-white;
      font-size: $fs12;
      .keys {
        flex-grow: 1;
        display: flex;
        align-items: flex-start;
        justify-content: flex-end;
      }
      .char-box {
        min-width: 15px;
        background-color: $color-white;
        color: $color-black;
        border-radius: 3px;
        padding: 2px 5px;
        font-size: $fs11;
        font-weight: 600;
        margin: 0 2px;
        text-transform: capitalize;
        display: inline-block;
        text-align: center;
      }
      .space {
        margin: 0 3px;
      }
    }
  }
  .not-found {
    background-color: $color-gray-60;
    padding: 4px 0;
    color: $color-white;
    display: flex;
    justify-content: center;
    margin-top: 4px;
    font-size: $fs12;
  }
}
